package com.example.win.android_banduyujia.peopleactivity.activity.activity.firmactivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;

import com.example.win.android_banduyujia.R;
import com.example.win.android_banduyujia.peopleactivity.ui.activity.BaseTitleBarActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Win on 2015/9/4.
 */
public class ScopeActivity extends BaseTitleBarActivity{

    private TextView mTxtGrid, mTxtIcon;

    private Spinner spinner;
    private ArrayAdapter<String>  Arrayadapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_scope_page);

        InitTitles();
        InitViews();
    }

    private void InitTitles() {
        showLeftBackButton();
        setTitle(R.string.layout_text_view_venues);
    }

    private void InitViews() {
        //mTxtIcon = (TextView) findViewById(R.id.text_view_change);

        spinner = (Spinner) findViewById(R.id.scope_spinner_text);
        Arrayadapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getDataSource());
        spinner.setAdapter(Arrayadapter);

        spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(getApplicationContext(), ListCityActivity.class);
                startActivityForResult(intent, 0);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
    }

    public List<String> getDataSource() {
        List<String>  lists = new ArrayList<String>();

        lists.add("北京");
        lists.add("上海");

        return lists;
    }
}